/*
 * @Author: lwHao
 * @Date: 2020-08-02 16:23:10
 * @LastEditors: lwHao
 * @LastEditTime: 2020-08-02 16:31:02
 */ 
import { h, init } from 'snabbdom'

let patch = init([])

let vnode = h('div#container',[
  h('h1', 'Hello Snabbdom'),
  h('p', 'p tag')
])

let app = document.querySelector('#app')

let oldVnode = patch(app, vnode)

setTimeout(() => {
  vnode = h('div#container', [
    h('h1', 'hello world'),
    h('p', 'hello p'),
  ])
  patch(oldVnode, vnode)

  // 清空页面 patch(oldVnode, null) x
  patch(oldVnode, h('!'))//注释节点
}, 2000);